﻿using System;

class GreatestCommonDivisor
{
    static void Main()
    {
        //Write a program that calculates the greatest common divisor (GCD) of given two numbers.
        //Use the Euclidean algorithm (find it in Internet).

        Console.Write("a = ");
        int a = int.Parse(Console.ReadLine());
        Console.Write("b = ");
        int b = int.Parse(Console.ReadLine());
        {
            while (a != 0 && b != 0)
            {
                if (a > b)
                    a -= b;
                else
                    b -= a;
            }
            Console.WriteLine("The GCD of the two numbers is: " + Math.Max(a, b));
        }
    }
}

